// Table 2: Summary Statistics, Initial vs. Final Sample //

clear all
cap log close

global path ""
use "$path/Main.dta", clear

local list_sumstat "log_pc_x_totexp popn land_area pct_urban term num_cand pctvote party_pres"
foreach var_sumstat in `list_sumstat' {

	* "Initial Sample" column
	sum `var_sumstat'
	local obs1 = `r(N)'
	local mean1 = `r(mean)'
	local sd1 = `r(sd)'

	* "Final Sample" column
	sum `var_sumstat' if position_rel != ""
	local obs2 = `r(N)'
	local mean2 = `r(mean)'
	local sd2 = `r(sd)'

	* Difference column
	ttesti `obs2' `mean2' `sd2' `obs1' `mean1' `sd1'

	* Note: The "N" shown is the maximum N (some variables may have some missing observations and have a lower N)

}

